<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="crm.model.Linkman"%>
<%@page import="crm.control.LinkmanControl"%>
<%@page import="crm.util.ParamUtil"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>linkman_update</title>
	</head>
	<body>
		<%
			request.setCharacterEncoding("UTF-8");
			Linkman linkman = new Linkman();
			int id = Integer.parseInt(request.getParameter("id"));
			linkman = LinkmanControl.getLinkmanById(id);

			String name = ParamUtil.getString(request, "name", null);
			linkman.setName(name);

			String position = ParamUtil.getString(request, "position",null);
			linkman.setPosition(position);

			String email = ParamUtil.getString(request, "email", null);
		    linkman.setEmail(email);

			String phone = ParamUtil.getString(request, "phone",null);
			linkman.setPhone(phone);

		    String hobby = ParamUtil.getString(request, "hobby",null);
			linkman.setHobby(hobby);

			int province = ParamUtil.getInt(request, "province_id",0);
			linkman.setProvince(province);

			String qq = ParamUtil.getString(request, "qq", null);
			linkman.setQq(qq);

			String birthaday = ParamUtil.getString(request, "birthday", null);
			linkman.setBirthday(birthaday);

		    String gender = ParamUtil.getString(request,"gender", null);
			linkman.setGender(gender);
			
			

			if (LinkmanControl.updateLinkman(linkman)){
		%>
		<script type="text/javascript">
if (window.confirm("修改成功！"))
	window.top.location.href = "linkman.jsp?id=<%=linkman.getCustomer_id()%>";
	else
    window.top.location.href = "linkman.jsp?id=<%=linkman.getCustomer_id()%>";
</script>
		<%
			} else {
		%>
		<script type="text/javascript">
if (window.confirm("修改失败！"))
	window.top.location.href = "linkman.jsp?id=<%=linkman.getCustomer_id()%>";
	else
    window.top.location.href = "linkman.jsp?id=<%=linkman.getCustomer_id()%>";
</script>
		<%
			}
		%>
	</body>
</html>